#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int main() {
    int a = 0;
    int i = 0;
    int c = 0;
    int arr[10] = { 0 };
    scanf("%d", &a);
    while (1) {

        arr[i] = (a % 6);
        a /= 6;
        if (a == 0)
            break;
        i++;
        c++;
    }
    for (c; c>=0; c--)
    {
        printf("%d", arr[c]);
    }
    return 0;
}













